package com.itheima.until;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class StringToDateConverter implements Converter<String,Date> {
    @Override
    public Date convert(String birth) {
        Date date = null;
        try {
            date = new SimpleDateFormat("yyyy-MM-dd").parse(birth);
        return date;
        } catch (ParseException e) {
            e.printStackTrace();
            return null;
        }

    }
}
